package com.hava.homework.service;

import org.springframework.stereotype.Component;
import org.springframework.util.comparator.BooleanComparator;

/**
 * Created by yanfa on 2016/10/16.
 * throw exception
 */
@Component
public class ThrowService {

    Boolean isthrow = true;

    public String create() throws Exception {
        System.out.println("Class ThrowService method do create");
        if(isthrow == true)
            throw new Exception("method throw create exception");
        else
            return "return create";
    }

    public String update() throws Exception {
        System.out.println("method do update");
        if(isthrow == true)
            throw new Exception("method throw update exception");
        else
            return "return update";
    }

    public String retrieve() throws Exception {
        System.out.println("method do retrieve");
        if(isthrow == true)
            throw new Exception("method throw retrieve exception");
        else
            return "return retrieve";
    }

    public String delete() throws Exception {
        System.out.println("method do delete");
        if(isthrow == true)
            throw new Exception("method throw delete exception");
        else
            return "return delete";
    }
}
